<template>
  <div style="margin-top: 310px">
    <el-button  style="font-size: 70px;background: #b7eef5;color: #ffd04b;">
      <span >{{newDate}}</span>
    </el-button>
  </div>
</template>
<script>
export default {
  data() {
    return{
      // 当前时间
      newDate: new Date()
    }
  },
// 挂载时间
  mounted () {
    let that = this
    this.timer = setInterval(function () {
      that.newDate = new Date().toLocaleString()
    })
  },
// 销毁时清除计时器
  beforeDestroy: function () {
    if (this.timer) {
      clearInterval(this.timer)
    }
  }
}
</script>
<style>

</style>